package com.jin.webvideo.util.thymeleaf;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("thyUtil")
public class StringUtil {

    public static String size(List list){
        if (list == null){
            return "0";
        }
        return String.valueOf(list.size());
    }

    public boolean equals(String a, String b){
        if (a == null && b== null){
            return true;
        }
        if (a == null || b== null){
            return false;
        }
        return a.equals(b);
    }

    public String toJson(Object obj) {
        return JSONObject.toJSONString(obj);
    }
}
